import Vue from 'vue'
import Router from 'vue-router'
import Login from './views/login/login'
import Layout from './views/layout/layout'
import Home from './views/Home'
import en from './i18n/lang/en'

// 不是必须加载的组件使用懒加载
const NotFound = () => import('./views/404');
const Upload = () => import('@/views/upload/upload');

Vue.use(Router);
let routeNmae = en.routeNmae;

let defaultRouter = [
    {
        path: '/',
        redirect: '/login',
        hidden: true,
        children: []
    },
    {
        path: '/login',
        component: Login,
        name: '',
        hidden: true,
        children: []
    },
    {
        path: '/index',
        iconCls: 'fa fa-dashboard', // 图标样式class
        name: 'home',
        component: Layout,
        alone: true,
        children: [
            {
                path: '/index',
                iconCls: 'fa fa-dashboard', // 图标样式class
                name: '主页',
                component: Home,
                children: []
            }
        ]
    },
    {
        path: '/404',
        component: NotFound,
        name: '404',
        hidden: true,
        children: []
    },
];

let addRouter = [
    // {
    //     path: '/',
    //     iconCls: 'el-icon-tickets', // 图标样式class
    //     name: routeNmae.article,
    //     component: Layout,
    //     children: [
    //         {
    //             path: '/addArticle',
    //             iconCls: 'el-icon-edit-outline', // 图标样式class
    //             name: routeNmae.publishArticle,
    //             component: AddArticle,
    //             children: []
    //         },
    //         {
    //             path: '/addArticleEditor',
    //             iconCls: 'el-icon-edit-outline', // 图标样式class
    //             name: routeNmae.publishArticleEditor,
    //             component: AddArticleEditor,
    //             children: []
    //         }
    //     ]
    // },
    // {
    //     path: '/',
    //     iconCls: 'fa fa-paw', // 图标样式class
    //     name: routeNmae.icon,
    //     component: Layout,
    //     children: [
    //         {
    //             path: '/icon',
    //             iconCls: 'fa fa-life-ring', // 图标样式class
    //             name: routeNmae.builtInIcon,
    //             component: Icon,
    //             children: []
    //         }
    //     ]
    // },
    // {
    //     path: '/',
    //     iconCls: 'fa fa-exchange', // 图标样式class
    //     name: routeNmae.shuttleBox,
    //     component: Layout,
    //     children: [
    //         {
    //             path: '/transfer',
    //             iconCls: 'fa fa-sign-in', // 图标样式class
    //             name: routeNmae.demoShuttle,
    //             component: Transfer,
    //             children: []
    //         }
    //     ]
    // },
    // {
    //     path: '/',
    //     iconCls: 'fa fa-universal-access', // 图标样式class
    //     name: routeNmae.permissions,
    //     component: Layout,
    //     children: [
    //         {
    //             path: '/pagePermissions',
    //             iconCls: 'fa fa-expeditedssl', // 图标样式class
    //             name: routeNmae.pageControl,
    //             component: pagePermissions,
    //             children: []
    //         },
    //         {
    //             path: '/btnPermissions',
    //             iconCls: 'fa fa-toggle-on', // 图标样式class
    //             name: routeNmae.btnControl,
    //             component: btnPermissions,
    //             children: []
    //         }
    //     ]
    // },
    //
    {
        path: '/',
        iconCls: 'fa fa-cloud-upload', // 图标样式class
        name: routeNmae.upload,
        component: Layout,
        meta: {role: ['superAdmin']},
        children: [
            {
                path: '/upload',
                iconCls: 'el-icon-upload2', // 图标样式class
                name: routeNmae.fileUpload,
                component: Upload,
                children: []
            }
        ]
    },
    {
        path: '*',
        redirect: '/404',
        hidden: true,
        children: []
    },

]

export default new Router({
    mode: 'hash',
    base: process.env.BASE_URL,
    routes: defaultRouter
})
export {defaultRouter, addRouter}
